.org 0xD86C ; Happy Quotes

Battle_Happy_Quotes:

	PUSH	{LR}
	SUB		SP, SP, 4
	LDR		R2, [Happy_Quotes_Offset]
	MOV		R1, 0xC
	LDR		R2, [R2, 0]
	MLA		R1, R0, R1, R2
	LDRB	R0, [R1, 0xC]
	AND 	R0, R0, 0x7F
	
	CMP		R0, 27								; Number of COs
	ADDLS	PC, PC, R0, LSL 2					; 
	
	B 		Happy_Quote_Set_9  					;  
	B 		Happy_Quote_Set_1 	 				; No CO
	B 		Happy_Quote_Set_1 					; Nell
	B 		Happy_Quote_Set_1 					; Andy
	B 		Happy_Quote_Set_1					; Max
	B 		Happy_Quote_Set_1					; Olaf
	B 		Happy_Quote_Set_1					; Sami
	B 		Happy_Quote_Set_1					; Grit
	B 		Happy_Quote_Set_1					; Kanbei	
	B 		Happy_Quote_Set_1					; Sonja
	B 		Happy_Quote_Set_4					; Eagle
	B 		Happy_Quote_Set_1					; Drake
	B 		Happy_Quote_Set_5					; Von Bolt
	B 		Happy_Quote_Set_8	 				; Jugger
	B 		Happy_Quote_Set_3					; Lash
	B 		Happy_Quote_Set_7					; Koal
	B 		Happy_Quote_Set_8 					; Hawke
	B 		Happy_Quote_Set_1					; Hachi
	B 		Happy_Quote_Set_1 					; Colin	
	B 		Happy_Quote_Set_6					; Jess
	B 		Happy_Quote_Set_6 					; Sensei
	B 		Happy_Quote_Set_1					; Jake
	B 		Happy_Quote_Set_1					; Rachel
	B 		Happy_Quote_Set_6					; Sasha
	B 		Happy_Quote_Set_1					; Javier
	B 		Happy_Quote_Set_1					; Grimm
	B 		Happy_Quote_Set_2					; Kindle
	B 		Happy_Quote_Set_2					; Flak
	B 		Happy_Quote_Set_7					; Adder

;-------------------------------------------------------------------------------	

Happy_Quote_Set_1:

	MOV		R0, 0
	MOV		R1, 2								; # Quotes
	
	BL		Get_Random_Number - OL_2_Offset		; Get a Random Number
	
	CMP		R0, 0
	BEQ		Quote_Set_Great_1
	
	CMP		R0, 1
	BEQ		Quote_Set_Perfect_1
	
	B		Quote_Set_All_Right_1

Quote_Set_Great_1:
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Great]				; Great
	POP		{LR}
	BX		LR
	
Quote_Set_Perfect_1:
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Perfect]			; Perfect
	POP		{LR}
	BX		LR
	
Quote_Set_All_Right_1:
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_All_Right]			; All Right
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------

Happy_Quote_Set_2:

	MOV		R0, 0
	MOV		R1, 1								; # Quotes
	
	BL		Get_Random_Number - OL_2_Offset		; Get a Random Number
	
	CMP		R0, 0
	BNE		Quote_Set_Ha_Ha_2
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Great]				; Great
	POP		{LR}
	BX		LR
		
Quote_Set_Ha_Ha_2:
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Ha_Ha]				; Ha ha
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------

Happy_Quote_Set_3:

	MOV		R0, 0
	MOV		R1, 1								; # Quotes
	
	BL		Get_Random_Number - OL_2_Offset		; Get a Random Number
	
	CMP		R0, 0
	BNE		Quote_Set_Ha_Ha_3
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_All_Right]			; All Right
	POP		{LR}
	BX		LR
		
Quote_Set_Ha_Ha_3:
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Ha_Ha]				; Ha ha
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------

Happy_Quote_Set_4:

	MOV		R0, 0
	MOV		R1, 1								; # Quotes
	
	BL		Get_Random_Number - OL_2_Offset		; Get a Random Number
	
	CMP		R0, 0
	BNE		Quote_Set_H_Ellipsis_4
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Great]				; Great
	POP		{LR}
	BX		LR
		
Quote_Set_H_Ellipsis_4:
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Ellipsis]			; ...
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------

Happy_Quote_Set_5:

	MOV		R0, 0
	MOV		R1, 1								; # Quotes
	
	BL		Get_Random_Number - OL_2_Offset		; Get a Random Number
	
	CMP		R0, 0
	BNE		Quote_Set_H_Ellipsis_5
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Ha_Ha]				; Ha ha
	POP		{LR}
	BX		LR
		
Quote_Set_H_Ellipsis_5:
	
	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Ellipsis]			; ...
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------

Happy_Quote_Set_6:

	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Great]				; Great
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------

Happy_Quote_Set_7:

	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Ha_Ha]				; Ha ha
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------

Happy_Quote_Set_8:

	ADD		SP, SP, 4
	LDR		R0, [Happy_Quote_Ellipsis]			; ...
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------

Happy_Quote_Set_9:

	LDR		R0, [Happy_Quote_Great]				; Great
	ADD		SP, SP, 4
	POP		{LR}	
	BX		LR

;-------------------------------------------------------------------------------	

Happy_Quotes_Offset:
	.dw 0x02360040

Happy_Quote_Great:	
	.dw Battle_Great							; Great!

Happy_Quote_Perfect:	
	.dw Battle_Perfect							; Perfect!

Happy_Quote_All_Right:	
	.dw Battle_All_Right						; All right!

Happy_Quote_Ha_Ha:	
	.dw Battle_Ha_Ha							; Ha ha!

Happy_Quote_Ellipsis:	
	.dw Battle_Ellipsis							; ...
	